using System;
using System.Collections;
using System.Collections.Generic;
using DoDove;
using Script;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;


public class TestUI : MonoBehaviour
{
    public Button addButton;
    public Button releaseButton;
    public Button disposeButton;
    public Button ressetButton;

    private List<PoolObjectTest> poolObjects = new List<PoolObjectTest>();

    // Start is called before the first frame update


    public DoDoveInputAction inputActions;
    private InputAction pointAction;

    void Start()
    {
        addButton.onClick.AddListener(() =>
        {
            var poolObject = PoolManager.Instance.GetPool<PoolTest>().Get();
            poolObjects.Add(poolObject);
        });

        releaseButton.onClick.AddListener(() =>
        {
            if (poolObjects.Count > 0)
            {
                PoolManager.Instance.GetPool<PoolTest>().Release(poolObjects[0]);
                poolObjects.Remove(poolObjects[0]);
            }
        });

        disposeButton.onClick.AddListener(() => { PoolManager.Instance.GetPool<PoolTest>().ReleaseAllPoolObjects(); });

        ressetButton.onClick.AddListener(() =>
        {
            poolObjects.Clear();
            PoolManager.Instance.GetPool<PoolTest>().SetPoolMaxSizeAndCapacity(10000, 5);
        });
        
        InputManager.Instance.InitDefaultMap();
    }

    // Update is called once per frame
    void Update()
    {
    }
}